ALMaSS  1.0
The Animal, Landscape and Man Simulation System
ALMaSS_CmdLine.cpp File Reference
#include "assert.h"
#include <cstdlib>
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#include <time.h>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <blitz/array.h>
#include "../BatchALMaSS/ALMaSS_Setup.h"
#include "../ALMaSSDefines.h"
#include "../Landscape/ls.h"
#include "../BatchALMaSS/MovementMap.h"
#include "../BatchALMaSS/BinaryMapBase.h"
#include "../BatchALMaSS/PopulationManager.h"
#include "../Vole/GeneticMaterial.h"
#include "../Skylark/skylarks_all.h"
#include "../Partridge/Partridge_All.h"
#include "../Partridge/Partridge_Population_Manager.h"
#include "../Vole/vole_all.h"
#include "../Vole/VolePopulationManager.h"
#include "../Vole/Predators.h"
#include "../Bembidion/bembidion_all.h"
#include "../Hare/hare_all.h"
#include "../Spider/spider_all.h"
#include "../Spider/SpiderPopulationManager.h"
#include "../MarshFritillary/MarshFritillaryHdrs.h"
#include "../BatchALMaSS/BoostRandomGenerators.h"
#include "../GooseManagement/GooseMemoryMap.h"
#include "../GooseManagement/Goose_Base.h"
#include "../BatchALMaSS/CurveClasses.h"
#include "../Hunters/Hunters_all.h"
#include "../GooseManagement/Goose_Population_Manager.h"
#include "../RoeDeer/Roe_all.h"
#include "../RoeDeer/Roe_pop_manager.h"
#include "../Rabbit/Rabbit.h"
#include "../Rabbit/Rabbit_Population_Manager.h"
#include "../Newt/Newt.h"
#include "../Newt/Newt_Population_Manager.h"
#include "../Osmia/Osmia.h"
#include "../Osmia/Osmia_Population_Manager.h"

Macros

#define _CRT_SECURE_NO_DEPRECATE
 

Functions

void RunTheSim ()
 
void CloseDownSim ()
 
bool ReadBatchINI ()
 
void GetProbeInput_ini ()
 
void CreateLandscape ()
 
bool CreatePopulationManager ()
 
void SpeciesSpecificReporting ()
 
void SpeciesSpecificActions ()
 
bool BeginningOfMonth ()
 
void DumpVegAreaData (int a_day)
 
void PredProbeReportDay0 (int a_time)
 
void ProbeReport (int a_time)
 
void ImpactProbeReport (int a_time)
 
int random (int a_range)
 
void delay (int secs)
 
void FloatToDouble (double &d, float f)
 
int main ()
 

Variables

boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
 
const double g_randmaxp = RAND_MAX + 1.0
 
static CfgInt cfg_DayInMonth ("PRB_DAYINMONTH", CFG_CUSTOM, 1)
 
static CfgBool cfg_UseEasyPop ("VOLE_USEEASYPOP", CFG_CUSTOM, false)
 
static CfgBool cfg_VoleCatastrophe_on ("VOLE_CATASTROPHE_ON", CFG_CUSTOM, false)
 
static CfgInt cfg_VoleCatastrophe_interval ("VOLE_CATASTROPHE_I", CFG_CUSTOM, 365 *5)
 
static CfgInt cfg_VoleCatastrophe_mortality ("VOLE_CATASTROPHE_M", CFG_CUSTOM, 90)
 
CfgBool cfg_dumpvegjan
 
CfgStr cfg_dumpvegjanfile
 
CfgBool cfg_dumpvegjune
 
CfgStr cfg_dumpvegjunefile
 
CfgBool cfg_fixed_random_sequence
 
PopulationManagerList g_PopulationManagerList
 
Landscapeg_ALandscape
 
Population_Managerg_AManager
 
Hunter_Population_Managerg_Hunter_Population_Manager
 
TPredator_Population_Managerg_PredatorManager
 
int g_Species
 
int g_torun
 This variable controls how long the simulation will run for. More...
 
char * g_files [100]
 
char * g_Predfiles [100]
 
char g_ResultsDir [255]
 
char g_PredResultsDir [255]
 
int g_time
 
int g_Year
 
int g_Steps
 
int g_NoProbes
 
unsigned g_NoOfPredProbes
 
ALMaSS_MathFuncs g_AlmassMathFuncs
 This variable provides access the to the internal ALMaSS math functions. More...
 

Macro Definition Documentation

◆ _CRT_SECURE_NO_DEPRECATE

#define _CRT_SECURE_NO_DEPRECATE

Function Documentation

◆ BeginningOfMonth()

bool BeginningOfMonth ( )

◆ CloseDownSim()

void CloseDownSim ( )
472  {
473  if ( g_AManager )
474  {
476  // Close the probe file
477  if ( g_AManager->TheProbe[ 0 ] != NULL ) g_AManager->TheProbe[ 0 ]->CloseFile();
478  // delete all probes
479  for ( int i = 0; i < g_NoProbes; i++ ) delete g_AManager->TheProbe[ i ];
480  delete g_AManager;
481  if ( g_Species == 1 ) {
482  delete g_PredatorManager;
483  }
484  }
485  delete g_ALandscape;
486  delete g_cfg;
487 }
TPredator_Population_Manager * g_PredatorManager
Definition: ALMaSS_CmdLine.cpp:124
Population_Manager * g_AManager
Definition: ALMaSS_CmdLine.cpp:122
int g_Species
Definition: ALMaSS_CmdLine.cpp:125
int g_NoProbes
Definition: ALMaSS_CmdLine.cpp:134
Landscape * g_ALandscape
Definition: ALMaSS_CmdLine.cpp:121
void SimulationClosingActions()
Definition: Landscape.cpp:1455
probe_data * TheProbe[100]
Definition: PopulationManager.h:510
void CloseFile()
Definition: PopulationManager.cpp:135
class Configurator * g_cfg
Definition: configurator.cpp:49

References probe_data::CloseFile(), g_ALandscape, g_AManager, g_cfg, g_NoProbes, g_PredatorManager, g_Species, Landscape::SimulationClosingActions(), and Population_Manager::TheProbe.

Referenced by main().

◆ CreateLandscape()

void CreateLandscape ( )
234  {
235  // Create the landscape
236  g_ALandscape = new Landscape();
237 }
The landscape class containing all environmental and topographical data.
Definition: landscape.h:113

References g_ALandscape.

Referenced by main().

◆ CreatePopulationManager()

bool CreatePopulationManager ( )
240  {
241  // SET UP THE ANIMAL POPULATION
242  // THE LANDSCAPE MUST BE SETUP BEFORE THE CALL HERE
243 
244  if ( g_Species == 0 ) {
246  g_AManager = skMan;
251  }
252  else if ( g_Species == 1 ) {
254  g_AManager = vMan;
259  }
260  else if ( g_Species == 2 ) {
261  Spider_Population_Manager * spMan = new Spider_Population_Manager( g_ALandscape );
263  g_AManager = spMan;
264  }
265  else if ( g_Species == 3 ) {
268  g_AManager = bMan;
269  }
270  else if ( g_Species == 4 ) { // Hare
273  g_AManager = hMan;
274  }
275  else if ( g_Species == 5 ) {
277  g_AManager = pMan;
279  }
280  else if ( g_Species == 6 ) {
282  g_AManager = gMan;
286  }
287  else if ( g_Species == 7 ) {
288  MarshFritillary_Population_Manager * mMan = new MarshFritillary_Population_Manager( g_ALandscape );
289  g_AManager = mMan;
291  }
292 #ifdef __dormouse //LADA
293  else if (g_Species == 8) {
294  Dormouse_Population_Manager * dMan = new Dormouse_Population_Manager(g_ALandscape);
295  g_AManager = dMan;
297  }
298 #endif // __dormouse
299  else if (g_Species == 9)
300  {
302  g_AManager = rMan;
304  }
305  else if (g_Species == 10)
306  {
308  g_AManager = rMan;
310  }
311  else if (g_Species == 11)
312  {
314  g_AManager = nwMan;
316  }
317  else if (g_Species == 12)
318  {
319  Osmia_Population_Manager * osMan = new Osmia_Population_Manager(g_ALandscape);
320  g_AManager = osMan;
322  }
323  else {
324  g_msg->Warn("Population_Manager::CreatePopulationManager() Unknown species number> ", g_Species);
325  exit(0);
326  }
327 
329  return true;
330 }
unsigned g_NoOfPredProbes
Definition: ALMaSS_CmdLine.cpp:135
Hunter_Population_Manager * g_Hunter_Population_Manager
Definition: ALMaSS_CmdLine.cpp:123
PopulationManagerList g_PopulationManagerList
Definition: ALMaSS_CmdLine.cpp:136
@ TOP_Beetle
Definition: PopulationManager.h:63
@ TOP_Hunters
Definition: PopulationManager.h:77
@ TOP_Vole
Definition: PopulationManager.h:61
@ TOP_RoeDeer
Definition: PopulationManager.h:67
@ TOP_Hare
Definition: PopulationManager.h:64
@ TOP_Goose
Definition: PopulationManager.h:66
@ TOP_Osmia
Definition: PopulationManager.h:70
@ TOP_Rabbit
Definition: PopulationManager.h:68
@ TOP_Predators
Definition: PopulationManager.h:76
@ TOP_Newt
Definition: PopulationManager.h:69
@ TOP_Skylark
Definition: PopulationManager.h:60
@ TOP_Spider
Definition: PopulationManager.h:62
@ TOP_Dormouse
Definition: PopulationManager.h:75
@ TOP_MarshFritillary
Definition: PopulationManager.h:74
@ TOP_Partridge
Definition: PopulationManager.h:65
The population manager class for beetles.
Definition: bembidion_all.h:386
The class to handle all goose population related matters.
Definition: Goose_Population_Manager.h:393
The class to handle all predator population related matters.
Definition: Hunters_all.h:335
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
The class to handle all newt population related matters.
Definition: Newt_Population_Manager.h:72
The population manager for partridge objects.
Definition: Partridge_Population_Manager.h:83
virtual bool OpenTheBreedingSuccessProbe()
Definition: PopulationManager.h:638
void SetNoProbes(int a_pn)
Definition: PopulationManager.h:431
virtual bool OpenTheBreedingPairsProbe()
Definition: PopulationManager.h:635
virtual bool OpenTheFledgelingProbe()
Definition: PopulationManager.h:632
void SetPopulation(Population_Manager *p_pm, TTypesOfPopulation a_pt)
Definition: PopulationManager.h:672
The class to handle all predator population related matters.
Definition: Rabbit_Population_Manager.h:90
Definition: Roe_all.h:483
Definition: skylarks_all.h:451
The class that handles all the population lists for hares.
Definition: hare_all.h:530
The class to handle all predator population related matters.
Definition: Predators.h:146
The class to handle all vole population related matters.
Definition: VolePopulationManager.h:152
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41

References g_ALandscape, g_AManager, g_Hunter_Population_Manager, g_msg, g_NoOfPredProbes, g_NoProbes, g_PopulationManagerList, g_PredatorManager, g_Species, Population_Manager::OpenTheBreedingPairsProbe(), Population_Manager::OpenTheBreedingSuccessProbe(), Population_Manager::OpenTheFledgelingProbe(), Population_Manager::SetNoProbes(), PopulationManagerList::SetPopulation(), TOP_Beetle, TOP_Dormouse, TOP_Goose, TOP_Hare, TOP_Hunters, TOP_MarshFritillary, TOP_Newt, TOP_Osmia, TOP_Partridge, TOP_Predators, TOP_Rabbit, TOP_RoeDeer, TOP_Skylark, TOP_Spider, TOP_Vole, and MapErrorMsg::Warn().

Referenced by main().

◆ delay()

void delay ( int  secs)
162  {
163  time_t start_time, cur_time;
164  time(&start_time);
165  do
166  {
167  time(&cur_time);
168  } while((cur_time - start_time) < secs);
169 }

◆ DumpVegAreaData()

void DumpVegAreaData ( int  a_day)

◆ FloatToDouble()

void FloatToDouble ( double &  d,
float  f 
)

◆ GetProbeInput_ini()

void GetProbeInput_ini ( )
334  {
335  char Nme[ 511 ];
336  ofstream * AFile=NULL;
337  for ( int NProbes = 0; NProbes < g_NoProbes; NProbes++ ) {
338  // Must read the probe from a file
339  g_AManager->TheProbe[ NProbes ] = new probe_data;
340  g_AManager->ProbeFileInput( ( char * ) g_files[ NProbes ], NProbes );
341  char NoProbesString[ 255 ];
342  sprintf( NoProbesString, "%sProbe.res", g_ResultsDir );
343  if ( NProbes == 0 ) {
344  AFile = g_AManager->TheProbe[ NProbes ]->OpenFile( NoProbesString );
345  if ( !AFile ) {
346  g_ALandscape->Warn( "BatchALMSS - cannot open Probe File", NULL );
347  exit( 1 );
348  }
349  } else
350  g_AManager->TheProbe[ NProbes ]->SetFile( AFile );
351  }
352  if ( g_Species == 1 ) {
353  for ( int NProbes = 0; NProbes < ( int )g_NoOfPredProbes; NProbes++ ) {
354  g_PredatorManager->TheProbe[ NProbes ] = new probe_data;
355  g_PredatorManager->ProbeFileInput( ( char * ) g_Predfiles[ NProbes ], NProbes );
356  sprintf( Nme, "%sPredProbe%d.res", g_ResultsDir, NProbes + 1 );
357  // strcpy( Nme, g_PredResultsDir );
358  if ( NProbes == 0 ) {
359  AFile = g_PredatorManager->TheProbe[ NProbes ]->OpenFile( Nme );
360  if ( !AFile ) {
361  g_ALandscape->Warn( "BatchALMSS - cannot open Probe File", Nme );
362  exit( 1 );
363  }
364  } else
365  g_PredatorManager->TheProbe[ NProbes ]->SetFile( AFile );
366  }
367  }
368  for ( int NProbes = 0; NProbes < g_NoProbes; NProbes++ ) {
369  delete [] g_files[NProbes];
370  }
371  for ( int NProbes = 0; NProbes < ( int )g_NoOfPredProbes; NProbes++ ) {
372  delete [] g_Predfiles[NProbes];
373  }
374 }
char * g_Predfiles[100]
Definition: ALMaSS_CmdLine.cpp:128
char * g_files[100]
Definition: ALMaSS_CmdLine.cpp:127
char g_ResultsDir[255]
Definition: ALMaSS_CmdLine.cpp:129
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
int ProbeFileInput(char *p_Filename, int p_ProbeNo)
Definition: PopulationManager.cpp:574
Data structure to hold & output probe data probe data is designed to be used to return the number of ...
Definition: PopulationManager.h:284
void SetFile(ofstream *F)
Definition: PopulationManager.cpp:1504
ofstream * OpenFile(char *Nme)
Definition: PopulationManager.cpp:1490

References g_ALandscape, g_AManager, g_files, g_NoOfPredProbes, g_NoProbes, g_PredatorManager, g_Predfiles, g_ResultsDir, g_Species, probe_data::OpenFile(), Population_Manager::ProbeFileInput(), probe_data::SetFile(), Population_Manager::TheProbe, and Landscape::Warn().

Referenced by main().

◆ ImpactProbeReport()

void ImpactProbeReport ( int  a_time)

◆ main()

int main ( )
191  {
192 #ifdef _DEBUG
193  // Get the current state of the flag
194  // and store it in a temporary variable
195  int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
196 
197  // Turn On (OR) - Keep freed memory blocks in the
198  // heap's linked list and mark them as freed
199  tmpFlag |= _CRTDBG_DELAY_FREE_MEM_DF;
200 
201  // Turn Off (AND) - prevent _CrtCheckMemory from
202  // being called at every allocation request
203  tmpFlag &= ~_CRTDBG_CHECK_ALWAYS_DF;
204  // Set the new state for the flag
205  _CrtSetDbgFlag( tmpFlag );
206 #endif
207  // Must come first. Used by the configurator below.
208  g_msg = new MapErrorMsg("ErrorFile.txt");
210 
211  // Configurator instantiation is automatic.
212  g_cfg->ReadSymbols("TIALMaSSConfig.cfg");
213  //g_cfg->DumpAllSymbolsAndExit( "allsymbols.cfg" );
214 
215  if (cfg_fixed_random_sequence.value()) srand( 0 ); else srand( (int)time( NULL ) );
216  CreateLandscape();
217  printf( "Landscape Created\n" ); // So now set up a Population Manager
218  if (!ReadBatchINI()) {
219  char ch;
220  cout << "Problem with ini file";
221  cin >> ch;
222  }
223  if (!CreatePopulationManager()) return false; else
224  printf( "Population Created\n" ); // Now got to get the probe files read in
227  // Ready to go
228  RunTheSim();
229  CloseDownSim();
230  return 0;
231 }
void RunTheSim()
Definition: ALMaSS_CmdLine.cpp:491
void GetProbeInput_ini()
Definition: ALMaSS_CmdLine.cpp:334
CfgBool cfg_fixed_random_sequence
bool ReadBatchINI()
Definition: ALMaSS_CmdLine.cpp:377
void CloseDownSim()
Definition: ALMaSS_CmdLine.cpp:472
void CreateLandscape()
Definition: ALMaSS_CmdLine.cpp:234
bool CreatePopulationManager()
Definition: ALMaSS_CmdLine.cpp:240
bool value(void)
Definition: configurator.h:135
bool ReadSymbols(const char *a_cfgfile)
Definition: configurator.cpp:201
void SetThePopManager(Population_Manager *a_ptr)
Set the pointer to the current main population manager.
Definition: landscape.h:177
Definition: maperrormsg.h:44
void SetWarnLevel(MapErrorState a_level)
Definition: maperrormsg.cpp:48
@ WARN_ALL
Definition: maperrormsg.h:40

References cfg_fixed_random_sequence, CloseDownSim(), CreateLandscape(), CreatePopulationManager(), g_ALandscape, g_AManager, g_cfg, g_msg, GetProbeInput_ini(), ReadBatchINI(), Configurator::ReadSymbols(), RunTheSim(), Landscape::SetThePopManager(), MapErrorMsg::SetWarnLevel(), CfgBool::value(), and WARN_ALL.

◆ PredProbeReportDay0()

void PredProbeReportDay0 ( int  a_time)

◆ ProbeReport()

void ProbeReport ( int  a_time)

◆ random()

int random ( int  a_range)
142  {
143  /* Want to raise exception on this?
144  if ( a_range <= 0 )
145  return 0;
146  */
147  //int result = (int)(((double) rand() / g_randmaxp ) * a_range);
148  return (int) (g_rand_uni()*a_range);
149  //return result;
150 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni

References g_rand_uni.

Referenced by Landscape::AddBeetleBanks(), Farm::AssignPermanentCrop(), Rabbit_Population_Manager::AssignStaticVariables(), Hare_Male::BeginStep(), Hare_Female::BeginStep(), Landscape::BorderScan(), Skylark_Female::CalculateEggNumber(), Roe_Base::CalculateRoadMortality(), Bembidion_Adult::CanReproduce(), Bembidion_Population_Manager::Catastrophe(), THare_Population_Manager::Catastrophe(), Partridge_Population_Manager::Catastrophe(), Skylark_Population_Manager::Catastrophe(), Vole_Population_Manager::Catastrophe(), Vole_Base::CheckTraps(), Partridge_Covey::ChickExtraMortality(), Partridge_Base::CopyMyself(), Bembidion_Base::CopyMyselfB(), Partridge_Covey::CoveyIndividualEmigrate(), Partridge_Population_Manager::CreateInitialObjects(), Partridge_Population_Manager::CreateObjects(), Vole_Population_Manager::CreateObjects_Init(), Bembidion_Egg_List::DailyMortality(), Partridge_Base::DailyMortality(), Skylark_Base::DailyMortality(), Vole_JuvenileMale::Dispersal(), Vole_Male::Dispersal(), Vole_JuvenileFemale::Dispersal(), Partridge_Covey::DistanceToCovey(), Partridge_Population_Manager::DoAfter(), RoadsideVerge::DoDevelopment(), THare_Population_Manager::DoFirst(), Partridge_Population_Manager::DoFirst(), Rabbit_Population_Manager::DoFirst(), Goose_Population_Manager::DoImmigration(), Vole_Base::DoWalking(), Vole_Base::DoWalkingCorrect(), Vole_Base::Escape(), THare_Population_Manager::ExtraPopMort(), Roe_Fawn::FAOnNewDay(), Roe_Fawn::FARecover(), Roe_Female::FDisperse(), Skylark_Female::FeedYoung(), Roe_Female::FEstablishRange(), Roe_Female::FFeed(), Partridge_Female::FFindingTerritory(), Roe_Female::FGiveBirth(), Partridge_Female::FIncubating(), FarmManager::FindFarmWithOpenness(), FarmManager::FindFarmWithRandom(), Partridge_Covey::FindNeighbour(), FarmManager::FindOpennessFarm(), Vole_Population_Manager::FindOutsideRadiusMale(), Vole_Population_Manager::FindRandomMale(), Vole_Population_Manager::FindWithinRadiusMale(), Partridge_Covey::FlyToFast(), Partridge_Covey::FlyToSlow(), Partridge_Female::FMakingNest(), Roe_Female::FOnNewDay(), THare::Forage(), THare::ForageP(), THare::ForageSquare(), THare::ForageSquareP(), Roe_Female::FRecover(), Roe_Female::FRuminate(), Partridge_Female::FStartingNewBrood(), Roe_Female::FUpdateGestation(), Goose_Population_Manager::GetForageLocIndex(), Goose_Population_Manager::GetLeader(), THare::GetPegDirection(), FarmManager::GetRandomFarmRefnum(), Weather::GetSnow(), Landscape::hb_MarkTheBresenhamWay(), Landscape::hb_StripingDist(), Partridge_Population_Manager::Hunting(), Partridge_Population_Manager::HuntingDifferentiatedBeetleBankArea(), Partridge_Population_Manager::HuntingGrid(), Bembidion_Adult::Init(), THare_Population_Manager::Init(), Bembidion_Population_Manager::Init(), RoeDeer_Population_Manager::Init(), Skylark_Population_Manager::Init(), Vole_Population_Manager::Init(), GeneticMaterial::Initiation(), GeneticMaterial1616::Initiation(), GeneticMaterial256_16::Initiation(), Partridge_Covey::KillChicks(), Landscape::Landscape(), Partridge_Population_Manager::MaleImmigration(), Partridge_Covey::ManagerCheckMerge(), Roe_Male::MDisperse(), Roe_Male::MFeed(), Roe_Male::MOnNewDay(), Partridge_Covey::MoveSelect(), Partridge_Covey::MoveSelectFuzzy(), Bembidion_Adult::MoveTo(), Bembidion_Adult::MoveTo_quality_assess(), Bembidion_Adult::MoveToAggr(), Partridge_Covey::MoveTryExclude(), Partridge_Covey::MoveTryExcludeHarder(), Partridge_Covey::MoveWeighDirection(), Roe_Male::MRecover(), Roe_Male::MRuminate(), GeneticMaterial::Mutation_1(), GeneticMaterial1616::Mutation_1(), GeneticMaterial::Mutation_1ab(), GeneticMaterial::Mutation_2(), GeneticMaterial1616::Mutation_2(), GeneticMaterial::Mutation_3(), GeneticMaterial1616::Mutation_3(), GeneticMaterial256_16::Mutation_3(), GeneticMaterial::Mutation_4(), Partridge_Covey::NestGoodSpot(), Newt_Juvenile::NewtDoWalking(), Newt_Juvenile::NewtDoWalkingCorrect(), Roe_Base::NextStep(), Roe_Male::On_Rank(), Bembidion_Larvae::OnFarmEvent(), Bembidion_Pupae::OnFarmEvent(), Bembidion_Adult::OnFarmEvent(), Hare_Infant::OnFarmEvent(), Hare_Young::OnFarmEvent(), Skylark_Clutch::OnFarmEvent(), Skylark_Nestling::OnFarmEvent(), Skylark_PreFledgeling::OnFarmEvent(), Skylark_Female::OnFarmEvent(), Skylark_Male::OnFarmEvent(), Partridge_Covey::Partridge_Covey(), Partridge_Female::Partridge_Female(), Partridge_Male::Partridge_Male(), SkTerritories::PreProcessLandscape2(), Rabbit_Population_Manager::Rabbit_Population_Manager(), VegElement::RandomVegStartValues(), Landscape::ReadPolys2(), GeneticMaterial::Recombine(), GeneticMaterial1616::Recombine(), GeneticMaterial256_16::Recombine(), Skylark_Adult::ReInit(), Skylark_Nestling::ReInit(), Roe_Female::Roe_Female(), Roe_Male::Roe_Male(), THare::Running(), Roe_Base::Running(), Roe_Fawn::RunTo(), Roe_Base::SeekCover(), Roe_Base::SeekNutri(), Population_Manager::Shuffle(), Skylark_Adult::Skylark_Adult(), Skylark_Nestling::Skylark_Nestling(), Bembidion_Adult::st_Aggregate(), Skylark_Male::st_CaringForYoung(), Bembidion_Pupae::st_Develop(), Hare_Male::st_Developing(), Hare_Female::st_Developing(), Skylark_Nestling::st_Developing(), Bembidion_Adult::st_Dispersal(), Hare_Juvenile::st_Dispersal(), TPredator::st_Dispersal(), Skylark_Female::st_Emigrating(), Skylark_Male::st_Emigrating(), Vole_JuvenileMale::st_Eval_n_Explore(), Vole_Male::st_Eval_n_Explore(), Vole_JuvenileFemale::st_Evaluate_n_Explore(), Vole_Female::st_Evaluate_n_Explore(), Skylark_Male::st_FindingTerritory(), Skylark_Female::st_Floating(), Skylark_Male::st_Floating(), Bembidion_Adult::st_Forage(), Bembidion_Adult::st_Hibernate(), TPredator::st_Hunting(), Skylark_Female::st_Immigrating(), Skylark_Male::st_Immigrating(), Vole_JuvenileMale::st_JuvenileExplore(), Vole_Female::st_Lactating(), TPredator::st_Movement(), Hare_Female::st_ReproBehaviour(), THare::THareInit(), TPredator_Population_Manager::TPredator_Population_Manager(), UnsprayedFieldMargin::UnsprayedFieldMargin(), THare::Walking(), Roe_Base::WalkTo(), and Bembidion_Adult::WinterMort().

◆ ReadBatchINI()

bool ReadBatchINI ( )
377  {
378  // Must read the TIBatch.INI
379  // Read the INI file
380  FILE * Fi = NULL;
381  char answer = 'X';
382  Fi=fopen("BatchALMaSS.ini", "r" );
383  while ( Fi==NULL ) {
384  // Issue and error warning
385  cout << "INI File Missing: ";
386  cout << "BatchALMaSS.ini" << "\n";
387  cout << "Try Again?";
388  cin >> answer;
389  if ( answer != 'Y' ) exit(0);
390  Fi = fopen("BatchALMaSS.ini", "r" );
391  }
392  char Data[ 255 ];
393  fscanf( Fi, "%d\r", & g_NoProbes );
394  for ( int i = 0; i < g_NoProbes; i++ ) {
395  fscanf( Fi, "%s\r", Data);
396  g_files[ i ] = new char[ 255 ];
397  strcpy( g_files[ i ], Data );
398  }
399  fscanf( Fi, "%s\r", Data );
400  strcpy( g_ResultsDir, Data );
401  // Read the PredBatch.INI file
402  if ( g_Species == 1) {
403  FILE * Fi2 = NULL;
404  answer = 'X';
405  while ( !Fi2 ) {
406  Fi2=fopen("VoleToxPreds.ini", "r" );
407  if ( !Fi2 ) {
408  // Issue and error warning
409  cout << "Predator Batch File Missing: VoleToxPreds.INI";
410  cout << "Try Again (Y/N) ? ";
411  cin >> answer;
412  if ( answer != 'Y' ) return false;
413  }
414  }
415  char Data2[ 255 ];
416  fscanf( Fi2, "%d\r", & g_NoOfPredProbes );
417  for ( int i = 0; i < ( int )g_NoOfPredProbes; i++ ) {
418  fscanf( Fi2, "%s\r", Data2 );
419  g_Predfiles[ i ] = new char[ 255 ];
420  strcpy( g_Predfiles[ i ], Data2 );
421  }
422  fscanf( Fi2, "%s\r", Data2 );
423  strcpy( g_PredResultsDir, Data2 );
424  fclose( Fi2 );
425  }
426  fscanf( Fi, "%d\r", & g_torun );
427  g_torun *= 365; // the number of years and multiplied by 365 to get days
428  fscanf( Fi, "%d\r", & g_Species );
429  fclose( Fi );
430  switch (g_Species) {
431  case 0:
432  printf("Running Skylarks\n");
433  break;
434  case 1:
435  printf("Running Voles\n");
436  break;
437  case 2:
438  printf("Running Spiders\n");
439  break;
440  case 3:
441  printf("Running Beetles\n");
442  break;
443  case 4:
444  printf("Running Hares\n");
445  break;
446  case 5:
447  printf("Running Partridges\n");
448  break;
449  case 6:
450  printf("Running Goose Management\n");
451  break;
452  case 7:
453  printf("Running Marsh Fritillary\n");
454  break;
455  case 8:
456  printf("Running Dormouse\n");
457  break;
458  case 9:
459  printf("Running Roe Deer\n");
460  break;
461  case 10:
462  printf("Running Rabbits\n");
463  break;
464  case 11:
465  printf("Running Newts\n");
466  break;
467  }
468  return true;
469 }
int g_torun
This variable controls how long the simulation will run for.
Definition: ALMaSS_CmdLine.cpp:126
char g_PredResultsDir[255]
Definition: ALMaSS_CmdLine.cpp:130

References g_files, g_NoOfPredProbes, g_NoProbes, g_Predfiles, g_PredResultsDir, g_ResultsDir, g_Species, and g_torun.

Referenced by main().

◆ RunTheSim()

void RunTheSim ( )
491  {
492  for ( int i = 0; i < g_torun; i++ ) {
494  // Update the Date
495  g_time++;
496 
497  printf("%d\r",g_time);
498  int day = g_ALandscape->SupplyDayInMonth();
499  int month = g_ALandscape->SupplyMonth();
500  if ( ( day == 1 ) && ( month == 1 ) ) g_Year++;
501 
502  if (g_Species == 1) g_PredatorManager->Run(1);
503  if (g_Species == 6)
504  {
505  for (int tenmin = 0; tenmin<144; tenmin++)
506  {
507  g_AManager->Run(1); // Goose Model
509  if (g_date->TickMinute10()) g_date->TickHour();
510  }
511  }
512  else g_AManager->Run(1);
513 
514  char str[255];
516 
518  }
519 }
int g_time
Definition: ALMaSS_CmdLine.cpp:131
int g_Year
Definition: ALMaSS_CmdLine.cpp:132
class Calendar * g_date
Definition: calendar.cpp:38
bool TickMinute10(void)
Definition: calendar.cpp:117
bool TickHour(void)
Definition: calendar.cpp:128
void TurnTheWorld(void)
Definition: landscape.h:905
int SupplyDayInMonth(void)
Definition: landscape.h:1606
void DumpVegAreaData(int a_day)
Definition: Landscape.cpp:4680
int SupplyMonth(void)
Definition: landscape.h:1601
virtual void Run(int NoTSteps)
Definition: PopulationManager.cpp:337
char * SpeciesSpecificReporting(int a_species, int a_time)
Definition: PopulationManager.cpp:1121
virtual void Run(int)
Definition: Predators.cpp:553

References Landscape::DumpVegAreaData(), g_ALandscape, g_AManager, g_date, g_Hunter_Population_Manager, g_PredatorManager, g_Species, g_time, g_torun, g_Year, Population_Manager::Run(), TPredator_Population_Manager::Run(), Population_Manager::SpeciesSpecificReporting(), Landscape::SupplyDayInMonth(), Landscape::SupplyMonth(), Calendar::TickHour(), Calendar::TickMinute10(), and Landscape::TurnTheWorld().

Referenced by main().

◆ SpeciesSpecificActions()

void SpeciesSpecificActions ( )

◆ SpeciesSpecificReporting()

void SpeciesSpecificReporting ( )

Variable Documentation

◆ cfg_DayInMonth

CfgInt cfg_DayInMonth("PRB_DAYINMONTH", CFG_CUSTOM, 1) ( "PRB_DAYINMONTH"  ,
CFG_CUSTOM  ,
 
)
static

◆ cfg_dumpvegjan

CfgBool cfg_dumpvegjan
extern

◆ cfg_dumpvegjanfile

CfgStr cfg_dumpvegjanfile
extern

◆ cfg_dumpvegjune

CfgBool cfg_dumpvegjune
extern

◆ cfg_dumpvegjunefile

CfgStr cfg_dumpvegjunefile
extern

◆ cfg_fixed_random_sequence

CfgBool cfg_fixed_random_sequence
extern

Referenced by main().

◆ cfg_UseEasyPop

CfgBool cfg_UseEasyPop("VOLE_USEEASYPOP", CFG_CUSTOM, false) ( "VOLE_USEEASYPOP"  ,
CFG_CUSTOM  ,
false   
)
static

◆ cfg_VoleCatastrophe_interval

CfgInt cfg_VoleCatastrophe_interval("VOLE_CATASTROPHE_I", CFG_CUSTOM, 365 *5) ( "VOLE_CATASTROPHE_I"  ,
CFG_CUSTOM  ,
365 *  5 
)
static

◆ cfg_VoleCatastrophe_mortality

CfgInt cfg_VoleCatastrophe_mortality("VOLE_CATASTROPHE_M", CFG_CUSTOM, 90) ( "VOLE_CATASTROPHE_M"  ,
CFG_CUSTOM  ,
90   
)
static

◆ cfg_VoleCatastrophe_on

CfgBool cfg_VoleCatastrophe_on("VOLE_CATASTROPHE_ON", CFG_CUSTOM, false) ( "VOLE_CATASTROPHE_ON"  ,
CFG_CUSTOM  ,
false   
)
static

◆ g_ALandscape

◆ g_AlmassMathFuncs

◆ g_AManager

◆ g_files

char* g_files[100]

Referenced by GetProbeInput_ini(), and ReadBatchINI().

◆ g_Hunter_Population_Manager

Hunter_Population_Manager* g_Hunter_Population_Manager

◆ g_NoOfPredProbes

unsigned g_NoOfPredProbes

◆ g_NoProbes

◆ g_PopulationManagerList

◆ g_PredatorManager

◆ g_Predfiles

char* g_Predfiles[100]

Referenced by GetProbeInput_ini(), and ReadBatchINI().

◆ g_PredResultsDir

char g_PredResultsDir[255]

Referenced by ReadBatchINI().

◆ g_rand_uni

boost::variate_generator<base_generator_type&, boost::uniform_real<> > g_rand_uni
extern

Referenced by random().

◆ g_randmaxp

const double g_randmaxp = RAND_MAX + 1.0

◆ g_ResultsDir

char g_ResultsDir[255]

Referenced by GetProbeInput_ini(), and ReadBatchINI().

◆ g_Species

◆ g_Steps

int g_Steps

◆ g_time

int g_time

Referenced by RunTheSim().

◆ g_torun

int g_torun

This variable controls how long the simulation will run for.

Referenced by Goose_Population_Manager::Goose_Population_Manager(), ReadBatchINI(), and RunTheSim().

◆ g_Year

int g_Year

Referenced by RunTheSim().